<template>
  <div>
    <!-- 修改店员信息 -->

    <!-- 面包屑导航 -->
    <Crumbs></Crumbs>

    <div class="admin-box">
      <el-form status-icon ref="ruleForm" label-width="100px" class="demo-ruleForm">
        <el-form-item label="店员">
          <el-input type="text" v-model="row.clerk" placeholder="请输入店员"></el-input>
        </el-form-item>
        <el-form-item label="姓名">
          <el-input type="text" v-model="row.rolename" placeholder="请输入姓名"></el-input>
        </el-form-item>
        <el-form-item label="所属门店">
          <el-input type="text" v-model="row.store" placeholder="选择门店" style="width: 70%"></el-input>
          <el-button @click="dialogVisible = true">选择门店</el-button>
        </el-form-item>
        <el-form-item label="状态">
          <el-radio-group v-model="row.state">
            <el-radio label="启用"></el-radio>
            <el-radio label="禁用"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" class="form-btn" @click="confirm">确认修改</el-button>
          <el-button class="form-btn" @click="revert">返回列表</el-button>
        </el-form-item>
      </el-form>

      <!-- 选择门店 -->

      <el-dialog title="选择门店" :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
        <SelectStore @choosep="choosep" @choicep="choicep"></SelectStore>
      </el-dialog>
    </div>
  </div>
</template>
<script>
import Crumbs from '../Crumbs.vue'
import SelectStore from './SelectStore.vue'
export default {
  data() {
    return {
      dialogVisible: false,
      row: '',
    }
  },
  methods: {
    handleClose(done) {
      done()
    },
    //确认修改
    confirm() {
      this.$router.push('/clerkAdmin')
    },
    // 返回列表
    revert() {
      this.$router.push('/clerkAdmin')
    },
    choosep(res) {
      console.log(res)
      this.dialogVisible = res.flage
      this.row.store = res.title
    },
    choicep(res) {
      console.log(res)
      this.dialogVisible = res.flage
      this.row.store = res.title
    },
  },
  components: { Crumbs, SelectStore },
  created() {
    //获取信息
    if (this.$route.params.list == undefined) {
      this.$router.push('/clerkAdmin')
    } else {
      console.log(this.$route.params.list)
      this.row = this.$route.params.list
    }
  },
}
</script>
<style lang="scss" scoped>
.admin-box {
  width: 100%;
  .demo-ruleForm {
    width: 500px;
  }
  .form-btn {
    margin-right: 20px;
  }
}
</style>
